﻿$(document).ready(function() {
	
   $("#countryName").change(function(){
	     $("#phoneCountryCode").val($("#countryName option:selected").attr('rel'));
   });
	
   	$("input[name='accountType']").change(function(){
   		var id = $(this).attr("id");
   		if(id == "accountTypeBusiness"){
   			$("#Organization").show("fast");
   		}
   		else{
   			$("#Organization").hide("fast");
   		}
   	});
   	
   	
   	$('#password').passwordStrength();   
   	$("#email").change(checkEmail);
  
    var cur_mouseon;
    var active_hint;

    $('form div.line div.value  label[for=accountTypePerson]').parent().mouseenter(function() {
        $("#hintPerson").stop(true, true).fadeIn('fast');
    });
    $('form div.line div.value  label[for=accountTypePerson] small').mouseenter(function() {
        return false;
    });

    $('form div.line div.value  label[for=accountTypeBusiness]').parent().mouseenter(function() {
        $("#hintCompany").stop(true, true).fadeIn('fast');
    });
    $('form div.line div.value  label[for=accountTypeBusiness] small').mouseenter(function() {
        return false;
    });

    $('form div.line div.value label[for=accountTypePerson]').parent().mouseleave(function() {
        $("#hintPerson").fadeOut();
    });

    $('form div.line div.value label[for=accountTypeBusiness]').parent().mouseleave(function() {
        $("#hintCompany").fadeOut();
    });

});



function checkEmail() {
    $("span.valid-email#emailLoad").hide();
    $("span.loading#emailLoad").show();     
    checkAjaxEmail($(this).val())    
}

function ToggleTextbox(selector) {
    if ($.browser.msie) {
        if ($(selector).css("display") == "block") {
            $(selector).hide();
        }
        else {
            $(selector).show();
        }      
    }
    else {
        $(selector).slideToggle();
    }
    return false;
}

function HideTextbox(selector) {
	
    $(selector).hide();
    $(selector).slideUp();
    return false;
}